home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: directories listing
- Date: Mon, 15 Jan 96 17:52:52 GMT
- Organization: none
- Message-ID: <821728372snz@genesis.demon.co.uk>
- References: <4dckfq$4um@news.ust.hk>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4dckfq$4um@news.ust.hk>
- cs_lcm@ug.cs.ust.hk "Lee Chun Man Raymond" writes:
-
- >
- >Hi,
- >
- > I wrote a C program that needs to print out a listing of
- >sub-directories of current working directory.
-
- Peter has answered your question. However:
-
- ...
-
- > strcpy(file_path, path_name);
- > strcat(file_path, "\\");
- > strcat(file_path, current_file.name)
- ;
-
- Don't overlook the powerful function sprintf. You could replace these 3
- statements with the simple:
-
- sprintf(file_path, "%s\\%s", path_name, current_file.name);
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-